class Solution {
public:
    string reverseWords(string s) {
        string ret,tmp;
        std::istringstream inputStream(s); 
        vector<string> sv;
        while(inputStream>>tmp)
        {
            sv.push_back(tmp);
        }
        ret=sv[sv.size()-1];
        for(int i=sv.size()-2;i>=0;i--)
            ret+=' '+sv[i];
        return ret;
    }
};
